package com.xiong.excel;


import com.alibaba.excel.EasyExcel;
import com.xiong.excel.constant.SystemConstants;
import com.xiong.excel.listener.PurchaseContractNewListener;
import com.xiong.excel.pojo.PurchaseContract;
import com.xiong.excel.listener.PurchaseContractListener;
import com.xiong.excel.pojo.PurchaseContractNew;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @author XiongDa
 */
@Slf4j
@SpringBootTest(classes = OneExcelToTemplateTest.class)
public class OneExcelToTemplateTest {

    /**
     * 数据导出到模板上
     * headRowNumber: 表头占几行
     * sheet: 输入读取sheet 默认第一个
     * @author 熊林飞
     * @date: 2022/8/22 14:55
     */
    @Test
    public void simpleRead() {
        EasyExcel.read(SystemConstants.SOURCE_FILE_NAME, PurchaseContract.class, new PurchaseContractListener())
                .headRowNumber(1)
                .sheet()
                .doRead();
    }

    /**
     * new
     * @author 熊林飞
     * @date: 2023/4/12 17:39
     */
    @Test
    public void simpleRead2() {
        EasyExcel.read(SystemConstants.SOURCE_FILE_NAME, PurchaseContractNew.class, new PurchaseContractNewListener())
                .headRowNumber(1)
                .sheet()
                .doRead();
    }


}
